package com.dq.controller.utils;

import com.dq.controller.AbstractController;
import com.dq.exception.customException.AdminException;
import com.dq.utils.DateUtils;
import com.dq.vo.ListDataVo;
import com.dq.vo.Vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author cf
 */

@RestController
@RequestMapping("/all/dateutils/")
@Api(description = "日期工具类")
public class DateUtilsControlle extends AbstractController {

    @GetMapping("yearList")
    @ApiOperation("年列表")
    public Vo yearList()throws AdminException{
        List<Integer> yearList = new ArrayList<>();
        int year = DateUtils.getYearByDate(new Date());
        yearList.add(year);
        for (int i = 0; i < 10; i++) {
            year-=1;
            yearList.add(year);

        }

        return new ListDataVo(yearList);
    }


}
